// base
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image } from '@tarojs/components'
// less
import './index.less'
import { navigateTo } from '../../../../crossplatform/apiservice/navigate'
import { pagejumplist } from '../../../../configuration/pagejump'
import scaleImageSrc from '../../../../util/pagemethods/scaleImageSrc'

class CompanyBar extends Component {
  static defaultProps = {
    detail: {}
  }
  componentWillMount() {
    // onLoad
  }

  componentDidMount() {
    // onready
  }

  componentDidShow() {
    // onshow
  }

  componentDidHide() {
    // onhide
  }

  componentWillUnmount() {
    // onUnload
  }

  delay(time = 0) {
    return new Promise(resolve => {
      setTimeout(() => {
        resolve()
      }, time)
    })
  }

  gotodetail = () => {
    navigateTo({
      url: pagejumplist['company-homepage'].path
    })
  }

  render() {
    return (
      <View className="CompanyBar_id60566" onClick={this.gotodetail}>
        <View className="companywrap">
          <View className="imgwrap">
            <Image className="imagein" src={scaleImageSrc(this.props.detail.pic)} />
          </View>
          <View className="cpname">
            <Text>京东JD</Text>
          </View>
          <Image
            className="rightbt"
            src="https://imagesize.hrwork.com/sp/files/22a7ecbc-e8b4-4f9f-a4c6-abd4c0956411.png"
          />
        </View>
      </View>
    )
  }
}

export default CompanyBar
